package hotel.meituan.oversea.biz.service;

import hotel.base.oversea.utils.Result;
import hotel.base.oversea.vo.meituan.request.order.MtHotelOrderCheckParamVo;
import hotel.meituan.oversea.api.dto.MtHotelOrderBookingDealingDto;
import hotel.meituan.oversea.api.entity.MtHotelOrderBooking;
import hotel.meituan.oversea.api.entity.MtHotelOrderStateHistory;
import hotel.meituan.oversea.api.vo.down.request.order.*;
import hotel.meituan.oversea.api.vo.switchs.OperateDltOrderVo;
import hotel.meituan.oversea.api.vo.up.response.order.MtHotelOrderBookingVo;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**美团酒店信息业务接口
 *
 */
@Service
public interface MtHotelOrderService {

    void updatePriceByOrderIndexId(String distributorOrderId_index, Integer totalPrice, Integer settlePrice);

    void updateMasterOrderCancelFailedCount(String masterIndexOrderId, String childOrderIndexId, Integer count);

    void updateMasterOrderCancelSuccessCount(String masterIndexOrderId, String childOrderIndexId, Integer cancelSuccesCount);

    Result<Object> orderBookingSplitOrder(MtHotelOrderBookingParamVo mtHotelOrderBookingParamVo, String masterOrderId);

    /**
     * 订单校验
     * @param mtHotelOrderParamVo
     * @return
     */
    Result<Object> orderCheckApi(MtHotelOrderCheckParamVo mtHotelOrderParamVo);

    /**
     * 订单预约
     * @param mtHotelOrderBookingParamVo
     * @return
     */
    Result<Object> orderBookingApi(MtHotelOrderBookingParamVo mtHotelOrderBookingParamVo, Integer swTotalPrice);

    /**
     * 订单取消
     * @param mtHotelOrderCancelParamVo
     * @return
     */
    Result<Object> orderCancelApi(MtHotelOrderCancelParamVo mtHotelOrderCancelParamVo);

    /**
     * 订单查询
     * @param mtHotelOrderQueryParamVo
     * @return
     */
    Result<Object> orderQuery(MtHotelOrderQueryParamVo mtHotelOrderQueryParamVo);

    /**
     * 催单
     * @param MtHotelOrderReminderParamVo
     * @return
     */
    Result<Object> hotelReminder(MtHotelOrderReminderParamVo MtHotelOrderReminderParamVo);

    /**
     * 保存提交的预约订单信息
     * @param mtHotelOrderBookingParamVo
     * @return
     */
    MtHotelOrderBooking saveRequsetOrderBooking(MtHotelOrderBookingVo mtHotelOrderBookingVo, MtHotelOrderBookingParamVo mtHotelOrderBookingParamVo, Integer orderState, Integer state, String newDisOrderId, String swOrderId, String masterOrderId, Integer split, Integer swPrice);

    /**
     * 修改预约订单
     * @param distributorOrderId
     * @return
     */
    void updateStateOrderBookingByDistributorOrderId(String distributorOrderId, Integer mtState, String remark, Integer state, Integer poolSysState);

    void saveOrderStateHistory(MtHotelOrderStateHistory mtHotelOrderStateHistory);

    /**
     * 获取处理中订单(确认中,取消中)
     * @return
     */
    Result<Object> getHotelOrderDealing(String gtTime);

    Result<Object> quartzQueryDealingOrderAndUpdateOrder(List<MtHotelOrderBookingDealingDto> ids);

    /**
     * 查询出该对象，forupdate 排他锁，当一个事务的操作未完成时候，其他事务可以读取但是不能写入或更新。
     * 数据被forupdate前要确保数据有存在，要先正常selectone出来；
     * 且forupdate查询出来后，一定要有后面操作update对象，才能释放锁。
     * @param  mtOrderId  美团平台返回订单id
     * @return
     */
    MtHotelOrderBooking selectOneByDisOrderIdForUpdate(String mtOrderId);

    MtHotelOrderBooking selectOneByMtDistributorOrderId(String mtOrderId);

    Result<Object> orderQueryBatch(List<MtHotelOrderQueryParamVo> mtHotelOrderQueryParamVoList);

    Result<Object> jobQueryOrderCheckSave(MtHotelOrderJobQueryOrderVo mtHotelOrderJobQueryOrderVo, MtHotelOrderStateHistory stateHistory, String source);

    Result<Object> getPageHotelOrderDealingForReminder();

    Result<Object> updateReminderCount(String mtOrderId, String isReminderRemark);
    boolean requestUpdateStateOrderPool(String logRemark, String mtOrderId, Integer orderStatus, Integer sysOrderState, String source, Integer isOrder, Integer orderWaitTime, String isOrderRemark);

    Result<Object> hhbCancelMt(String orderId);

    List<MtHotelOrderBooking> selectOneBySwOrderIsVail(String swOrderId);

    Result operaterDltOrder(OperateDltOrderVo operateDltOrderVo);

    void updateMasterOrderSuccessSplitCount(String masterOrderId, String childOrderIndexId, Integer splitSuccesCount, Integer days);

    void updateSplitOrderIsFailed(String master_mtDisOrderId_index);

    List<MtHotelOrderBooking> getBookingChildOrderByMasterOrderId(String master_mtDisOrderId_index);

    void updateMasterOrderStatusByDistrId(String master_mtDisOrderId_index, Integer orderStatus, String remark);

    void updateOneChildOrderStatus(String masterOrderIndexId, String childOrderIndexId, Integer orderStatus, String apiMtOrderId);

    void updateOneMasterSplitOrderIsFailed(String master_mtDisOrderId_index, String childOrderIndexId, Integer oper);

    void updateMasterOrderOper(String distributorOrderId, Integer orderStatus, Integer i);
    /**
     * 获取订单是否为拆单
     * @param map
     * @return
     */
    Result<Object> getOrderType(Map map);
}
